﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using StudentManage.Data;

namespace StudentManage.Web.Personal
{
    public partial class assess : SecurityPage
    {

        public string GetProjectType(string Pid)
        {
            Project md = Project.Where("id=@0", int.Parse(Pid)).First();
            string TypeName = Enum.GetName(typeof(EnumData.ProjectType), Convert.ToInt32(md.ProjectTypeid));
            string TypeInfoName = TypeInfo.Where("id=@0", md.Typeid).First().TypeName;
            return TypeName + "-" + TypeInfoName;
        }

        private void LoadData()
        {
            int Pid = Convert.ToInt32(Request.QueryString["Pid"].ToString());
            Apply Amd = Apply.Where("id=@0", Pid).First();
            Project Pmd = Project.Where("id=@0", Amd.Projectid).First();
            Evaluate md = Evaluate.Where("Projectid=@0 and Userid=@1", Amd.Projectid, Amd.Userid).First();

            this.lab_ProjectTypeName.Text = this.GetProjectType(md.Projectid.ToString());
            this.lab_ProjectTitle.Text = Pmd.Title;
            this.lab_UserName.Text = md.UserName;
            this.lab_ApplyTime.Text = Amd.ApplyTime.ToString();
            this.lab_AssessLevel.Text = md.Rank;
            this.lab_Contents.Text = md.Contents;
            this.lab_AddTime.Text = md.AddTime.ToString();
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.QueryString["Pid"] != null)
                LoadData();
        }
    }
}